<?php
    /*$GLOBALS['TL_DCA']['tl_content']['palettes']['text'] = str_replace
    (
        'headline',
        'headline,template',
        $GLOBALS['TL_DCA']['tl_content']['palettes']['text']
    );*/
    //print_r($GLOBALS['TL_DCA']['tl_content']['palettes']);
    
    
    foreach($GLOBALS['TL_DCA']['tl_content']['palettes'] as $key => $val) {
        if(!is_array($val)) {
            $GLOBALS['TL_DCA']['tl_content']['palettes'][$key] .= ';template';
        }
    }
    
    $GLOBALS['TL_DCA']['tl_content']['fields']['template'] = array
    (
			'label'                   => &$GLOBALS['TL_LANG']['tl_content']['template'],
			'exclude'                 => true,
			'filter'                  => true,
			'search'                  => true,
			'inputType'               => 'select',
			'options_callback'        => array('tl_m17FrontendTemplates', 'loadTemplatefiles'),
			'eval'                    => array()
    );

class tl_m17FrontendTemplates extends Backend
{
    public function loadTemplatefiles(DataContainer $dc)
    {
        $template = 'ce_'.$dc->activeRecord->type;
        return $this->getTemplateGroup($template);
    }
}